﻿using B.S.Sterilizationcenter.Domain.zmc;
using B.S.Sterilizationcenter.ErrorCode;
using B.S.Sterilizationcenter.Read.API.Appliaction.Commends.zmc.Outbounds;
using B.S.Sterilizationcenter.Read.API.Dto;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace B.S.Sterilizationcenter.Read.API.Controllers.ZMC
{/// <summary>
/// 出库单
/// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class OutboundsController : ControllerBase
    {
        private readonly IMediator mediator;

        public OutboundsController(IMediator mediator)
        {
            this.mediator = mediator;
        }


        /// <summary>
        /// 查询出库单
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        /// 
        [HttpGet]
        public async Task<ApiResult<List<OutboundDto>>> QueryOutboundorder([FromQuery]QueryOutboundorderCommends request, CancellationToken cancellationToken)
        {
            try
            {
                return await mediator.Send(request, cancellationToken);

            }
            catch (Exception)
            {

                throw;
            }
        }

        /// <summary>
        /// 查询出库类型
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        /// 
        [HttpGet]
        public async Task<ApiResult<List<OutboundType>>> QueryOutboundType([FromQuery]QueryOutboundTypeCommends request, CancellationToken cancellationToken)
        {
            try
            {
                return await mediator.Send(request, cancellationToken);
            }
            catch (Exception)
            {

                throw;
            }
        }
    }
}
